package servlet;

import model.classes;
import model.student;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;

@WebServlet(value = "/s_seeScore")
public class s_seeScore extends HttpServlet{
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        String username = (String)req.getSession().getAttribute("using");

        HashMap<classes,Integer> hashMap = student.seeScore(username);
        if (!hashMap.isEmpty()) {
            req.setAttribute("s_seeScore",hashMap);
            req.getRequestDispatcher("/jsp/s_seeScore.jsp").forward(req,resp);
        }
    }


    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }
}
